<template>
	<view class="container">
		<view class="per-zl-head">
			<text class="per-zl-headTitle">个人资料</text>
			<view class="per-zl-headav">
				<text>头像</text>
				<view class="per-zl-headavImg">
					<image :src="avatar" mode="widthFix"></image>
				</view>
			</view>
			<view class="per-zl-headinfo">
				<view class="per-zl-headinfoItem">
					<text>姓名</text>
					<view class="per-zl-headinfoItemIpt">
						<input type="text" value="" v-model="username" placeholder="请输入姓名"/>
					</view>
				</view>
				<view class="per-zl-headinfoItem">
					<text>手机号</text>
					<view class="per-zl-headinfoItemIpt">
						<input type="number" value="" v-model="usertel" placeholder="请输入手机号"/>
					</view>
				</view>
				<view class="per-zl-headinfoItem">
					<text>身份证号</text>
					<view class="per-zl-headinfoItemIpt">
						<input type="number" value="" v-model="userID" placeholder="请输入身份证号"/>
					</view>
				</view>
			</view>
		</view>
		<view class="">
			
		</view>
	</view>
</template>

<script>
	import app from '../../App.vue';
	export default{
		data(){
			return{
				avatar:'',
				username:'',
				usertel:'',
				userID:''
				
			}
		},
		onLoad(options) {
			// this.getdetailList()
			this.getuserinfo()
		},
		onShow() {
			
		},
		methods: {
			getuserinfo(){			//个人信息
				let that = this
				app.post('api/user/index','GET').then(res=>{
					if(res.code == 1){
						console.log(res)
						that.avatar = res.data.avatar
						that.username = res.data.nickname
						that.usertel = res.data.mobile
						that.userID = res.data.id_no
					}else if(res.code == 0){
						uni.showToast({
							title: res.msg,
							icon: 'none',
							mask: true
						})
					}else if(res.code == 401){
						uni.showToast({
							title: res.msg,
							icon: 'none',
							mask: true
						})
					}
				}).catch(err=>{
					uni.showToast({
						title: err.msg,
						icon: 'none',
						mask: true
					})
				})
			},
		}
	}
</script>

<style>
	@import url("../../common/perziliao.css");
</style>
